package com.itestor.iptv.modules.common.actions;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.itestor.iptv.modules.common.bean.AlertConfigBean;
import com.itestor.iptv.modules.common.bean.FileConfigBean;
import com.itestor.iptv.modules.common.bean.ProcessConfigBean;
import com.itestor.iptv.modules.common.bean.RecordModeConfigBean;
import com.itestor.iptv.modules.common.bean.SystemConfigBean;
import com.itestor.iptv.modules.common.bean.UploadConfigBean;
import com.itestor.iptv.modules.common.service.RobotConfigService;

/**
 * 
 * @author Mr.li
 * 
 */
public class RobotConfigNaviAction extends DispatchAction {

    /**
     * 业务对象.
     */
    RobotConfigService robotConfigService;

    /**
     * 获取文件配置
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showFileConfig(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        FileConfigBean fileBean = robotConfigService.getFileConfigBean();
        request.setAttribute("configBean", fileBean);
        return mapping.findForward("showFileConfig");
    }

    /**
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showUploadConfig(ActionMapping mapping,
            ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        UploadConfigBean cofigBean = robotConfigService.getUploadConfigBean();
        request.setAttribute("configBean", cofigBean);

        return mapping.findForward("showUploadConfig");
    }

    /**
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showAlertConfig(ActionMapping mapping,
            ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        AlertConfigBean bean = robotConfigService.getAlertConfigBean();
        request.setAttribute("configBean", bean);
        return mapping.findForward("showAlertConfig");
    }

    /**
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showModeConfig(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        RecordModeConfigBean bean = robotConfigService
                .getRecordModeConfigBean();
        request.setAttribute("configBean", bean);
        return mapping.findForward("showModeConfig");
    }

    /**
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showSystemConfig(ActionMapping mapping,
            ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        SystemConfigBean configBean = robotConfigService.getSystemConfigBean();
        request.setAttribute("configBean", configBean);
        return mapping.findForward("showSystemConfig");
    }

    /**
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showProcessConfig(ActionMapping mapping,
            ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        ProcessConfigBean bean = robotConfigService.getProcessConfigInfo();
        request.setAttribute("configBean", bean);
        return mapping.findForward("showProcessConfig");
    }

    /**
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     * @throws Exception
     */
    public ActionForward showUserConfig(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        Map<String, String> userMap = robotConfigService.getSystemUser();
        request.setAttribute("userMap", userMap);

        return mapping.findForward("showUserConfig");
    }

    /**
     * @param pRobotConfigService
     */
    public void setRobotConfigService(RobotConfigService pRobotConfigService) {
        robotConfigService = pRobotConfigService;
    }

}
